package com.css.fxfzcpxx.modules.houseSeismicEvaluation.repository.impl;

import com.css.fxfzcpxx.modules.houseSeismicEvaluation.entity.EstResult;
import com.css.fxfzcpxx.modules.houseSeismicEvaluation.repository.EstResultRepository;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository
public class EstResultRepositoryImpl implements EstResultRepository {
    @Resource
    NamedParameterJdbcTemplate namedParameterJdbcTemplate;

    @Override
    public void save(EstResult estResult) {
        String sql = "insert into ypg_survey_task(id, chse_id, inte9sity, break_state) " +
                "values(:id, :chseId, :intensity, :breakState)";
        SqlParameterSource source = new BeanPropertySqlParameterSource(estResult);
        namedParameterJdbcTemplate.update(sql, source);
    }
}
